<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="commons/header.jsp" %>
<style type="text/css" media="screen">
.expense-low {
	background-color: #93de8b;
}

.expense-high {
	background-color: #e4765c;
}
</style>
<script type="text/javascript">
	/*!
	 * Ext JS Library 3.3.1
	 * Copyright(c) 2006-2010 Sencha Inc.
	 * licensing@sencha.com
	 * http://www.sencha.com/license
	 */
	Ext.onReady(function() {
		var myStore = new Ext.data.ArrayStore({
			autoLoad : true,
			fields : [ 'discipline', 'purview', 'rela' ],
			url : 'list'
		});

		var pivotGrid = new Ext.grid.PivotGrid({
			title : 'Матрица компетенций',
			width : 1000,
			height : 400,
			//renderTo : 'docbody',
			store : myStore,
			aggregator : 'sum',
			renderer : function(value) {
				//just a little hacky boy ;)
				if (value == "0yes") {
					return "yes";
				} else {
					return "no";
				}
			},
			measure : 'rela',

			viewConfig : {
				getCellCls : function(value) {
					if (value == "yes") {
						return 'expense-low';
					}
				}
			},

			leftAxis : [ {
				width : 300,
				dataIndex : 'discipline'
			} ],

			topAxis : [ {
				dataIndex : 'purview'
			} ]

		});
		var win = new Ext.Window({
			layout : 'fit',
			align : top,
			width : 1200,
			height : 400,
			closable : false,
			resizable : false,
			plain : true,
			border : false,
			items : [ pivotGrid ],
			buttons : [ {
				text : 'Добавить дисциплину',
				handler : function() {
					window.location = 'adddis.html';
				}
			}, {
				text : 'Добавить компетенцию',
				handler : function() {
					window.location = 'addpur.html';
				}
			}, {
				text : 'Добавить связь',
				handler : function() {
					window.location = 'addlink.html';
				}
			} ]
		});
		win.show();
	});
	</script>
<%@ include file="commons/footer.jsp"%>